/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tkatva.soalog.SoalogEjb.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author tuomas
 */
@Entity
@Table(name = "user_group")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "UserGroup.findAll", query = "SELECT u FROM UserGroup u")})
public class UserGroup implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "user_group_id")
    private Integer userGroupId;
    @Size(max = 45)
    @Column(name = "user_groupcol")
    private String userGroupcol;
    @Size(max = 45)
    @Column(name = "mapped_name")
    private String mappedName;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "userGroupId")
    private List<InterfaceUserGroups> interfaceUserGroupsList;

    public UserGroup() {
    }

    public UserGroup(Integer userGroupId) {
        this.userGroupId = userGroupId;
    }

    public Integer getUserGroupId() {
        return userGroupId;
    }

    public void setUserGroupId(Integer userGroupId) {
        this.userGroupId = userGroupId;
    }

    public String getUserGroupcol() {
        return userGroupcol;
    }

    public void setUserGroupcol(String userGroupcol) {
        this.userGroupcol = userGroupcol;
    }

    public String getMappedName() {
        return mappedName;
    }

    public void setMappedName(String mappedName) {
        this.mappedName = mappedName;
    }

    @XmlTransient
    public List<InterfaceUserGroups> getInterfaceUserGroupsList() {
        return interfaceUserGroupsList;
    }

    public void setInterfaceUserGroupsList(List<InterfaceUserGroups> interfaceUserGroupsList) {
        this.interfaceUserGroupsList = interfaceUserGroupsList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (userGroupId != null ? userGroupId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof UserGroup)) {
            return false;
        }
        UserGroup other = (UserGroup) object;
        if ((this.userGroupId == null && other.userGroupId != null) || (this.userGroupId != null && !this.userGroupId.equals(other.userGroupId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "tkatva.soalog.SoalogEjb.entities.UserGroup[ userGroupId=" + userGroupId + " ]";
    }
    
}
